/*******************************************************
> Copyright (C) 2024 ==IOT== All rights reserved.
> File Name: virtual_destructor.cpp
> Author: IOT
> Website:www.slq.org
> Created Time: 2024年10月25日 星期五 16时13分37秒
***************************************************/

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

class Base {

	public:
		virtual ~Base()
		{
			cout << "基类析构" << endl;
		}
};

class Derived : public Base {
	int *ptr;
	public:
		Derived()
		{
			ptr = new int;
		}
		~Derived()
		{
			delete ptr;
			cout << "派生类析构" << endl;
		}
	
};

int main(int argc,const char* argv[])
{
	//Base base;
	//Derived der;
	
	Base *p = new Derived;
	
	delete p;
	
    return 0;
}
